home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 401-425 / disk_419 / reqlib / req.doc < prev    next >
Text File  |  1992-05-06  |  70KB  |  1,909 lines

  1.  
  2.  
  3.                        ReqLibrary, release 2.5
  4.                       -------------------------
  5.                       Sat Nov 24  02:53:12 1990
  6.  
  7.  
  8.     The  req.library is a run time re-entrant library that is designed
  9. to  make  it  easier  for  programmers  to  use  powerful, easy to use
  10. requesters  for  communicating  with  users.   The  requester  library
  11. includes  such functions as a color requester, file requester, message
  12. display  requester  and many functions to make the creation of gadgets
  13. for your own custom requesters easier.
  14.  
  15.     Req.library  was  written  by  Colin  Fox (of Pyramyd Designs) and
  16. Bruce  Dawson  (of  CygnusSoft  Software).   Req.library  is  a freely
  17. distributable  library that may be used in commercial products without
  18. paying  any  royalties.  We encourage you to use the requester library
  19. in all of your programs, to make them easier to write, and to use.
  20.  
  21.     Req.library  is  not public domain.  The requester library and all
  22. documentation and example programs are all copyright 1989.
  23.  
  24. //////////////////////////////////////////////////////////////////////
  25.  
  26.     The  requester  library  is  freely distributable.  If you wish to
  27. supply  the  source  code  to your program, we would ask that you also
  28. include the req.library archive file.  This is what it should contain:
  29.  
  30.  
  31.                 releasestuff/customizefile
  32.                 releasestuff/req.doc
  33.                 releasestuff/req.fd
  34.                 releasestuff/req.library
  35.                 releasestuff/showoffreq
  36.                 releasestuff/showoffreq.c
  37.                 releasestuff/asm/customizefile.asm
  38.                 releasestuff/asm/reqglue.asm
  39.                 releasestuff/include/macros.i
  40.                 releasestuff/obj/areqglue.o
  41.                 releasestuff/obj/areqglue50d.o
  42.                 releasestuff/obj/lreqglue.o
  43.                 releasestuff/obj/lreqgluenb.o
  44.                 releasestuff/include/clib/req_protos.h
  45.                 releasestuff/include/libraries/reqbase.h
  46.                 releasestuff/include/libraries/reqbase.i
  47.                 releasestuff/include/pragmas/req.h
  48.                 releasestuff/include/proto/req.h
  49.  
  50.  
  51. //////////////////////////////////////////////////////////////////////
  52. Changes from req 2.4 to req 2.5
  53.  
  54. - It was pointed out to me that Showoffreq.c and reqglue.asm haven't been
  55.   updated in a while, so here they are, updated.
  56.  
  57. - This version includes updates for both Lattice reqglue and Aztec reqglue.
  58.   There are 4 reqglues-
  59.          lreqgluenb.o  - for old Lattice or for Lattice compatable executables.
  60.                          the nb is for No Base relative addressing
  61.          lreqglue.o    - for new Lattice.
  62.  
  63.          areqglue.o    - old 3.6x Aztec
  64.  
  65.          areqglue50d.o - New 5.0d Aztec
  66.  
  67.  
  68. - I've also included the .fd file with this release, so if you wish to produce
  69.   a pragma file (or the equivalent), it's now easier.
  70.  
  71. //////////////////////////////////////////////////////////////////////
  72. Changes from req 2.3 to req 2.4
  73.  
  74. - Since Commodore saw fit to use our FileRequester name for their structure,
  75.   I have to change it to 'struct ReqFileRequester{};'
  76.  
  77. - And just to forstall any further problems, I changed ScrollStruct to
  78.   ReqScrollStruct.
  79.  
  80.   I know these are minor changes, but it had to be done.
  81.  
  82. //////////////////////////////////////////////////////////////////////
  83. Changes from req 2.2 to req 2.3
  84.  
  85. - It was found that the definition of ReqBase was as a *Library, not
  86.   as a *ReqLib, which would preclude getting to the various handy
  87.   pointers. This was fixed.
  88.  
  89. - Tune-ups have been made to the reqbase.? include files.
  90.  
  91. //////////////////////////////////////////////////////////////////////
  92.  
  93. Changes from req 1.2 to req 2.2
  94.  
  95. - All requesters handle fonts properly under Workbench 2.0
  96.  
  97. - The TextRequest now has a timeout. You supply the length of time, in
  98.   seconds, and the requester will CANCEL itself after that time.
  99.  
  100. - The GetLong requester now displays the Minimum and Maximum values
  101.   on the window.
  102.  
  103. - Format() has been renamed ReqFormat(), since there is now a DOS routine
  104.   called Format() that does something significantly different.
  105.  
  106. - ReqFormat() now returns the length of the formatted string, and it is
  107.   now safe to pass a null result buffer. This is useful if you wish to
  108.   allocate space for a string without needing a buffer first. Just run
  109.   ReqFormat() on the string once without a result buffer, and it will tell
  110.   you how long the string is. Then allocate the memory and do it again
  111.   with the result buffer.
  112.  
  113. - For future compatability, you must now put REQVERSION in all Version
  114.   structure fields. This begins now, as the Timeout routine looks at
  115.   the version.
  116.  
  117. -  RealTimeScroll  now  passes, as the 5th parameter (and in A0) the scroll
  118.    structure  to ScrollAndDraw (your routine).  This allows easier creation of
  119.    re-entrant   code  (you  don't  need  to  have  a  global  pointer  to  the
  120.    scrollstruct).
  121.  
  122. - ARexx interface
  123.    Many thanks to Steve Lyons for writing the rexx module for req.library.
  124.    To hook req.library in as an ARexx function library, you must execute the
  125.    following line:
  126.  
  127.     rxlib req.library -5 -60 2
  128.  
  129.    For example, my rxlib settings read as such:
  130.  
  131.     rxlib rexxmathlib.library  5 -30 0
  132.     rxlib rexxapclib.library   0 -30 0
  133.     rxlib rexxsupport.library -5 -30 0
  134.     rxlib rexxarplib.library -10 -30 0
  135.     rxlib req.library         -5 -60 2
  136.  
  137.  
  138.    Steve also wrote the following 4 ARexx <-> Req bindings:
  139.  
  140.  
  141. ------------------------------------------------------------------------------
  142. colourreq()
  143.  
  144.     This function requires no parameters, but you CAN pass the default colour
  145.     if you like.
  146.  
  147. ------------------------------------------------------------------------------
  148. intreq("Title",min,max)
  149.  
  150.     This function now displays the min and max values, so you know what's expected.
  151.  
  152. ------------------------------------------------------------------------------
  153. stringreq("Title","initial string",StringBufSize,VisibleSize)
  154.  
  155.     The only manditory paramter is Title.
  156.     There is no default initial string, so it would be blank
  157.     StringBufSize defaults to 255
  158.     VisibleSize defaults to 40
  159. ------------------------------------------------------------------------------
  160. textreq("Text body","Title","Cancel"," Ok ","Middle",timeout)
  161.  
  162.     Something new for req.library 2.2 is timeouts. Right now the only requester
  163.     that has timeouts is TextRequest(), but they will be added to the others.
  164.  
  165.     the timeout is in seconds. When the timeout expires, it returns FALSE.
  166.  
  167.     The only required parameter is the "Text Body"
  168.  
  169. ------------------------------------------------------------------------------
  170.  
  171.  
  172. //////////////////////////////////////////////////////////////////////
  173.  
  174.  
  175.  
  176.     Req.library  is  dedicated  to  the programmers who make the Amiga
  177. shine the way it was meant to.
  178.  
  179.  
  180. OverView:
  181.  
  182.     All  of  the  req.library functions that bring up requesters allow
  183. you two ways of specifying what screen you would like the requester to
  184. appear  on.  The first way is the more efficient way, because you only
  185. have  to set it up once and then it takes care of things automatially.
  186. There  is  a  field in all process structures called the pr_WindowPtr.
  187. This  pointer  is  used by DOS to decide where to put it's requesters.
  188. If  pr_WindowPtr  contains  a  zero,  requesters  go  on the workbench
  189. screen.  If it contains the address of a window, then requesters go on
  190. that  window's  screen.   If  it  contains a negative one, then no DOS
  191. requesters come up.  The req.library requesters all use this variable,
  192. if  they  are  called from a process .  However, if the pointer is -1,
  193. the req.library functions do still appear, on the workbench screen.
  194.  
  195.     The  second  way  was  put in mainly so that the requesters can be
  196. called from tasks.  Since a task does not have a process structure, it
  197. also  lacks a pr_WindowPtr.  Therefore, all of the requester functions
  198. which  can  be  used from a task (currently everything except the file
  199. requester) can be passed a window pointer, either as a parameter or as
  200. an  element in a structure.  Important:  This pointer takes precedence
  201. over  the  pr_WindowPtr  so  if  you  wish  the  requesters to use the
  202. pr_WindowPtr  you  must  zero  the window fields that the routines are
  203. expecting.   In  the case of fields in a structure this can be easy as
  204. long   as  you  make  sure  your  structure  defaults  to  being  zero
  205. everywhere.
  206.  
  207.     Setting  the  pr_WindowPtr is quite a simple matter.  All you have
  208. to do is do a FindTask((char *)0); which returns a pointer to your own
  209. task  and your own process (a task structure is the first element of a
  210. process  structure).   Then  you  simply  preserve  the  old  value of
  211. pr_WindowPtr (VERY IMPORTANT!!!) and put a window pointer into it.
  212.  
  213. eg:
  214.                 /* Find my task. */
  215.     myprocess = (struct Process *)FindTask((char *)0);
  216.     oldwindowptr = myprocess->pr_WindowPtr;
  217.     myprocess->pr_WindowPtr = window;
  218.  
  219. or:
  220.  
  221.     MOVE.L  4,A6
  222.     MOVE.L  #0,A1
  223.     SYS     FindTask    ;Find my task.
  224.     MOVE.L  D0,_myprocess
  225.     MOVE.L  D0,A0
  226.     MOVE.L  pr_WindowPtr(A0),_oldwindowptr
  227.     MOVE.L  _window,pr_WindowPtr(A0)
  228.  
  229.     Before your program exits it is VERY important that it restore the
  230. previous  value of pr_WindowPtr.  If you don't, then your program will
  231. work  in some situations, but will BLOW UP in others.  For example, if
  232. you  execute  (without  using the 'run' command) a program, which then
  233. sets  the  pr_WindowPtr  to  point at one of its windows and the exits
  234. without  restoring  it,  then  the  next time a DOS requester tries to
  235. appear...  BOOM!  The machine will probably crash as DOS tries to open
  236. a requester on a now closed screen.  Therefore, before leaving:
  237.  
  238.     myprocess->pr_WindowPtr = oldwindowptr;
  239.  
  240. or:
  241.  
  242.     MOVE.L  _myprocess,A0
  243.     MOVE.L  _oldwindowptr,pr_WindowPtr(A0)
  244.  
  245.  
  246.  
  247.     One  final  note.   The  pr_WindowPtr  field exists in the process
  248. structure.   This  means  that  a  task  does  not  have  this  field.
  249. Therefore,  if you want to call one of the requester library functions
  250. from  a  task,  you  will not be able to specify what screen you would
  251. like  the  requester  to  appear on by setting the pr_WindowPtr field.
  252. All  of  the  functions  that open requesters and can be called from a
  253. task  (the file requester/font requester is the only one that can't be
  254. called  froma task) have some other way of specifying which screen you
  255. would like them to open on.  They will have either have a field in the
  256. structure  which you must pass them or a parameter which can contain a
  257. window  pointer  to one of the windows on your custom screen.  If this
  258. pointer is non-zero then it overrides the pr_WindowPtr field.
  259.  
  260.  
  261.  
  262.  
  263.     By  opening the requester library, you not only gain access to all
  264. of  the functions documented below, but to some other goodies as well.
  265. Req.library   needs  and  therefore  opens  several  other  libraries,
  266. including  dos.library,  intuition.library,  graphics.library  and the
  267. console  device.   All  of  these  pointers  are  stored in the ReqLib
  268. structure  which  you  get a pointer to when you open the req.library.
  269. Therefore,  you  can  save  yourself  a little bit of code by grabbing
  270. these  fields  after opening the requester library.  The only thing to
  271. beware of is don't use these values after you have close the requester
  272. library,  because  at  that point there is no guarantee that they will
  273. still be valid.
  274.  
  275.     In  addition  to  these  libraries,  the Images pointer in the req
  276. library structure points to a set of ten small images (four arrows and
  277. six  letters  [R,  G,  B, H, S, V]) which have are guaranteed to be in
  278. chip  memory.  These can be used if your program requires this type of
  279. images.
  280.  
  281.  
  282.  
  283.  
  284.     One  thing to keep in mind when using the gadget creation routines
  285. is  that there isn't any way for us to check that you have passed us a
  286. pointer  to  the  correct size of buffer, so you _must_ make sure that
  287. you are allocating the right amount of memory.
  288.  
  289.  
  290.     The  two  glue files (lreqglue.o and areqglue.o) are for Lattice-C
  291. (now  SAS/C)  and  Aztec-C  respectively.   If  you  don't have direct
  292. library access, simply link in the appropriate glue file to access the
  293. library.
  294.  
  295.      --------------------------------------------------------------
  296.             Here's a quick list of the functions available:
  297.      --------------------------------------------------------------
  298.  
  299. Center..................Center a new window over the mouse.
  300.  
  301. SetSize.................Prop gadget handling routines (32 bit)
  302. SetLocation
  303. ReadLocation
  304.  
  305. ReqFormat..................sprintf() format routine
  306.  
  307. SimpleRequest...........Starter gluecode to TextRequest- Single gadget
  308. TwoGadRequest...........Starter gluecode to TextRequest- Two gadgets
  309.  
  310. FileRequester...........FileRequester routines
  311. PurgeFiles
  312.  
  313. ColorRequester..........a colorrequester
  314.  
  315. MakeGadget..............Gadget creation routines
  316. MakeString
  317. MakeProp
  318. MakeButton
  319.  
  320. MakeScrollBar...........3   part   gadget;   2   arrows  and  a  prop.
  321.                         Horizontal or Vertical
  322.  
  323. LinkGadget..............Gadget  creation  routines that self-hook into
  324.                         the newwindow
  325. LinkStringGadget........gadget list.
  326. LinkPropGadget
  327.  
  328. DrawBox.................Draw a box (x1y1)(x2y2) in one command
  329.  
  330. GetFontHeightAndWidth...return height and width of current font
  331.  
  332. RealTimeScroll..........scroll routine used in file requester
  333.  
  334. TextRequest.............Powerful requester function
  335.  
  336. GetString...............Get a line of text from the user
  337. GetLong.................Get a signed long from the user
  338.  
  339. RawKeyToAscii...........Convert raw key to ascii
  340. NewGetString............Get a line of text from the user - uses GSS structure
  341.  
  342. ----------------------------------------------------------------
  343.  
  344.  
  345. NAME
  346.         Center
  347.  
  348.  
  349. SYNOPSIS
  350.         Center( &nw, x, y)
  351.                  A0 D0 D1
  352.  
  353. struct NewWindow *nw;
  354. USHORT x,y;
  355.  
  356. DESCRIPTION
  357.  
  358.     Center()  is  used  to  adjust  a  NewWindow structure so that the
  359. window that it opens will appear immediately under the mouse.  The x,y
  360. values  are used to specify which part of the window you would like to
  361. appear  underneath  the mouse.  If x or y is zero, that tells Center()
  362. to  position  the  window  so  that  the  window center (in the x or y
  363. direction  respectively)  is  underneath  the  mouse.   If  x  or y is
  364. positive, that tells Center() to position the window so that the mouse
  365. is  that  many  pixels  from  the  left  or  top  edge  of  the window
  366. respectively.   If x or y is negative, that tells Center() to position
  367. the  window  structure so that the mouse appears that many pixels from
  368. the right or bottom edge of the window respectively (ie; x = -10 tells
  369. Center  to  position  the  mouse  ten  pixels to the left of the right
  370. edge).
  371.  
  372.     If it is impossible to position the window exactly where requested
  373. (if  the  mouse  pointer  is too close to the edge of the screen) then
  374. this  routine  will  position  the  window as close as possible to the
  375. correct location.
  376.  
  377.     To  allow  this routine to work accurately it is necessary to have
  378. already initialized the new window structure to specify on what screen
  379. the  window  is  going  to  be  open.  ie; you should set the Type and
  380. Screen fields before calling Center().
  381.  
  382.     This routine disturbs no registers.
  383.  
  384. RETURNS
  385.         nothing
  386. SEE
  387.  
  388. BUGS
  389.         None known
  390.  
  391.  
  392. ;--------------------------------------------------------------------
  393.  
  394. NAME
  395.             SetSize
  396. SYNOPSIS
  397.  
  398.             SizeVal=SetSize(MaxValue,ViewSize)
  399.               D0.W              D0.L  D1.L
  400.  
  401. short   SizeVal;
  402. long    MaxValue,ViewSize;
  403.  
  404. DESCRIPTION
  405.  
  406.     This  routine is designed to correctly handle sizing a prop gadget
  407. to  a range.  The range is given in in MaxValue/ViewSize.  MaxValue is
  408. the  maximum value that this prop is supposed to be able to represent.
  409. Viewsize  is  how  large  the  display area is.  For instance, if your
  410. maximum  value  was 200 (files, for example), and your viewsize was 15
  411. (lines of text), then you would call this as so:
  412.  
  413.         SizeVal=SetSize(200,15);
  414.  
  415.     Then you would put SizeVal into the appropriate PropInfo structure
  416. element (in the case of the file requester, that would be VertBody).
  417.  
  418. RETURNS
  419.         The  16 bit value to be put into the PropInfo structure of the
  420. prop gadget.
  421.  
  422. SEE
  423.         SetLocation, ReadLocation
  424. BUGS
  425.         Bugs? what bugs?
  426.  
  427.  
  428. ;--------------------------------------------------------------------
  429.  
  430. NAME
  431.             SetLocation
  432. SYNOPSIS
  433.  
  434. NewLoc = SetLocation(MaxValue,ViewSize,Value);
  435.   D0                    D0      D1      D2
  436.  
  437. short NewLoc;
  438. long MaxValue,ViewSize,Value;
  439.  
  440. DESCRIPTION
  441.  
  442.             When you have a prop gadget that you wish to directly set,
  443. then  this  is  the  routine to use.  It allows you to pass any 32 bit
  444. value and properly set the gadget.
  445.  
  446. RETURNS
  447.  
  448.     The  return  is  the value to put into either HorizPot or VertPot,
  449. depending on what orientation you have the gadget.
  450.  
  451.  
  452. BUGS
  453.  
  454.     n/a
  455.  
  456. EXAMPLE
  457.  
  458. SEE
  459.     SetSize(),ReadLocation()
  460.  
  461. ;--------------------------------------------------------------------
  462.  
  463. NAME
  464.             ReadLocation
  465. SYNOPSIS
  466.  
  467. LocVal=ReadLocation(MaxValue,ViewSize,PotValue)
  468.   D0                  D0.L    D1.L     D2.W
  469.  
  470. long LocVal,MaxVal,ViewSize;
  471. short PotValue;
  472.  
  473.  
  474. DESCRIPTION
  475.  
  476.         If  you  prop  gadget has been moved, this is the routine that
  477. you would use to determine where it's been moved to.
  478.  
  479. RETURNS
  480.         Returns  the decoded value of the prop, as an unsigned 32 bit.
  481. This  is  the  element  number  (line  number  usually) that should be
  482. displayed on the first line of your display window.
  483.  
  484. SEE
  485.  
  486.     SetSize(), SetLocation()
  487.  
  488. BUGS
  489.     n/a
  490.  
  491. EXAMPLE
  492.  
  493. ;--------------------------------------------------------------------
  494.  
  495. NAME
  496.             ReqFormat
  497. SYNOPSIS
  498.  
  499.  len =  ReqFormat(Buffer,string,values)
  500.   D0                A2      A0     A1
  501.  
  502. char *Buffer,string[];
  503. char **values;
  504. long len;
  505.  
  506. DESCRIPTION
  507.  
  508.         This does the same thing as sprintf(), except that it isn't in
  509. the  stdio  library, and doesn't use up very much room.  This function
  510. uses  the  ROM  function  RawDoFmt to do the print() style formatting.
  511. This  routine does not allow the use of all of the '%' directives (for
  512. example,  floating  point  numbers can not be printed with this).  For
  513. full   documentation   on  what  directives  are  supported,  see  the
  514. documentation  on RawDoFmt.  This is the routine that TextRequest (and
  515. therefore   SimpleRequest   and  TwoGadRequest)  use  for  their  text
  516. formatting, so these restrictions apply to them also.
  517.  
  518.         The RawDoFmt routine also assumes that 'int's are sixteen bits
  519. long.   Therefore,  if  you  are  using a compiler with an int size of
  520. thirty-two  bits and you want to print an int or a short, you must use
  521. '%ld', rather than '%d'.
  522.  
  523.         Req  2.2 now returns the length of the formatted string in D0.
  524. This can be used with passing a null buffer to do more accurate memory
  525. allocations for strings.
  526.  
  527.         It  is  now (as of req 2.2) harmless to supply an empty result
  528. buffer.   The  result  of  this  is simply obtaining the length of the
  529. formatted string.
  530.  
  531.  
  532. RETURNS
  533.         The number of characters in the formatted string.
  534. BUGS
  535.     none known
  536.  
  537. EXAMPLE
  538.  
  539.     ReqFormat(Buffer,"There are %d changes to the file %s.",numchanges,
  540. filename);
  541.  
  542.     ReqFormat(Buffer,"%x is a hex number, %c is a character.", num, chr);
  543.  
  544. SEE
  545.     TextRequest, SimpleRequest, TwoGadRequest.
  546.     Further  information  on printf() style formatting is available in
  547. the AutoDocs on RawDoFmt and in C manuals discussing printf().
  548.  
  549. ;--------------------------------------------------------------------
  550.  
  551.  
  552.  
  553. NAME
  554.             ColorRequester
  555. SYNOPSIS
  556.  
  557. NewColor=ColorRequester(DesiredColor);
  558.    D0                       D0
  559. long    DesiredColor;
  560.  
  561. DESCRIPTION
  562.  
  563.     This  is a full-fledged color requester.  It is intelligent enough
  564. to open with the right number of colours in the palette automatically.
  565. It  shows  you both the colour you are working with, and the numerical
  566. RGB  value  of  that  colour.   It  has  Spread,  Undo,  Ok and Cancel
  567. functions.  Planned is the addition of HSV.
  568.  
  569.     The  cursor  keys move the color-cursor around the palette, RETURN
  570. selects the current color and ESC cancels out.
  571.  
  572.     You  pass  this  routine  the  color that you would like initially
  573. highlighted  (typically  the  current drawing colour).
  574.  
  575.     The ExtendedColorRequester function has slightly more options, but
  576. is slightly more work to call.
  577.  
  578. RETURNS
  579.  
  580.     Color  number  that  the user selected, -1 if the user cancels the
  581. colour  requester.   The  changed  colours  will  be  in  the viewport
  582. structure for your screen.
  583.  
  584. SEE
  585.     ExtendedColorRequester
  586.  
  587. BUGS
  588.  
  589.     none known.
  590.  
  591. EXAMPLE
  592.  
  593.     newcolor = ColorRequester(oldcolor);
  594.  
  595. ;--------------------------------------------------------------------
  596.  
  597. NAME
  598.             ExtendedColorRequester
  599. SYNOPSIS
  600.  
  601. NewColor=ExtendedColorRequester(&(struct ExtendedColorRequester)
  602.    D0                                      A0
  603. struct ExtendedColorRequester   colorreqstruct;
  604.  
  605. DESCRIPTION
  606.     This  call  brings  up  exactly  the  same  color requester as the
  607. ColorRequester  call.  The only difference is that this routine allows
  608. you  to  specify  more  parameters.   The difference is actually quite
  609. small  right  now, because there is only one additional parameter that
  610. can  be  passed  through  this  entry  point.   This is the ecr_window
  611. parameter,  used  to  specify  what window (and hence what screen) the
  612. color 'requester' appears on.  This parameter is rarely needed because
  613. the  window  the requester opens up on can be specified by setting the
  614. pr_WindowPtr  field  in  your process structure to the address of your
  615. window  structure  (see  the  beginning of the docs for an overview on
  616. this procedure).  The only time this entry point is needed, currently,
  617. is  if you try to bring up the color requester on a custom screen from
  618. a  task,  since  a task does not have a pr_WindowPtr and can therefore
  619. not specify the window and screen.
  620.  
  621. RETURNS
  622.  
  623.     Color  number  that  the user selected, -1 if the user cancels the
  624. colour  requester.   The  changed  colours  will  be  in  the viewport
  625. structure for your screen.
  626.  
  627. SEE
  628.     ColorRequester
  629.  
  630. BUGS
  631.  
  632.     none known.
  633.  
  634. EXAMPLE
  635.  
  636.         /* This should generally be declared as a global variable */
  637.         /* so that all of it's elements get initialized to zero.  */
  638.         /* If you declare it as a local variable, be sure to zero */
  639.         /* all of the fields, even the unused ones. */
  640.     struct ExtendedColorRequester   colorstruct;
  641.  
  642.     colorstruct.defcolor = 0;
  643.     colorstruct.window = mywindow;
  644.     newcolor = ExtendedColorRequester(&colorstruct);
  645.  
  646. ;--------------------------------------------------------------------
  647.  
  648. NAME
  649.             MakeGadget
  650. SYNOPSIS
  651. MakeGadget(Buffer,String, X, Y)
  652.               A0    A1   D0 D1
  653. struct Buffer   *GadgetBlock;
  654. char            *String;
  655. long            D0,D1;
  656. DESCRIPTION
  657.  
  658.         This  routine  prepares a buffer to be a standard BOOLEAN text
  659. gadget.   This is a simple way of producing gadgets for code that must
  660. be  reentrant,  and it is more efficient than defining gadgets in data
  661. statements.    The  routine  initializes  the  gadgets  to  a  set  of
  662. 'standard' values that should cover most cases and then links the four
  663. parts of the GadgetBlock together.
  664.  
  665.     Buffer  is  a pointer to a unitialized GadgetBlock, which contains
  666. the  necessary  Gadget, Border, border pairs and IntuitText structures
  667. needed to render a boolean gadget with a border and some text.
  668.  
  669.     String  is  a  pointer  to  the text that should appear inside the
  670. gadget.   The  gadget  is  automatically  sized  to  match the strings
  671. length.
  672.  
  673.     X  and  Y are the gadgets initial position, they are simply copied
  674. into LeftEdge and TopEdge in the gadget structure.
  675.  
  676. RETURNS
  677. SEE
  678. BUGS
  679. EXAMPLE
  680.  
  681.  
  682. ;--------------------------------------------------------------------
  683.  
  684. NAME
  685.             MakeString
  686.  
  687. SYNOPSIS
  688. MakeString(Buffer,StringBuff,UndoBuff,MaxWidthBits,MaxNumChars, X, Y)
  689.              A0      A1          A2        D0          D1      D2  D3
  690.  
  691. struct Buffer   *StringBlock;
  692. char            *StringBuff;
  693. char            *UndoBuff;
  694. long            MaxWidthBits, MaxNumChars, X, Y;
  695.  
  696. DESCRIPTION
  697.  
  698.     As  with  all  of  the  MakeGadget  functions, this one prepares a
  699. buffer  to  be used as a string gadget, that may be used re-entrantly.
  700. The  buffer need not be cleared first.  This means that you may create
  701. a temporary gadget on the stack.
  702.  
  703.     The  StringBuff  is  where the body of text inside the gadget will
  704. reside.
  705.  
  706.     When   the   gadget  is  activated,  the  text  in  StringBuff  is
  707. automatically copied (by intuition) into UndoBuff.  This allows you to
  708. type  Amiga-Q  and get the old string back.  This field may be null if
  709. you wish to have no undo.
  710.  
  711.     MaxWidthBits is the width of the frame around the gadget.
  712.  
  713.     MaxNumChars  is  the maximum number of characters that you will be
  714. able  to  type  into the gadget, including the terminating zero on the
  715. string.  MAKE SURE that this number is no greater than your StringBuff
  716. size, or else you're going to be typing over memory that isn't yours.
  717.  
  718.     X,Y  are the position of the upper left hand corner of the gadget.
  719. The border is actually 2 pixels above and to the left of this corner.
  720.  
  721. RETURNS
  722.     Nothing
  723. SEE
  724.  
  725.     MakeGadget,MakeProp,MakeScrollbar,LinkGadget,LinkProp,LinkString
  726.  
  727.  
  728. ;--------------------------------------------------------------------
  729.  
  730. NAME
  731.             MakeProp
  732. SYNOPSIS
  733.  
  734. MakeProp(Buffer,Width,Height,Flags)
  735.          A0       D0   D1    D2
  736.  
  737. struct  Buffer  *PropBlock;
  738. long            Width, Height, Flags;
  739.  
  740. DESCRIPTION
  741.  
  742.     This  routine  prepares an un-initialized buffer for use as a prop
  743. gadget.
  744.  
  745.     Buffer,  on  return,  will  contain  the  gadget,  along  with the
  746. necessary PropInfo and Image structures, all linked together.
  747.  
  748.     Width is the with of the container, in pixels.
  749.     Height is the height of the container in pixels.
  750.  
  751.     The  Flags  parameter  is  where you decide if you want FREEHORIZ,
  752. FREEVERT, or both.  It is simply copied into the gadget flags field.
  753.  
  754.  
  755. RETURNS
  756.  
  757.     Nothing
  758.  
  759.  
  760. ;--------------------------------------------------------------------
  761.  
  762. NAME
  763.             DrawBox
  764. SYNOPSIS
  765.  
  766. DrawBox(rp,MinX,MinY,MaxX,MaxY)
  767.         A1  D0   D1   D2   D3
  768.  
  769. struct  RastPort        *rp;
  770. long    MinX,MinY,MaxX,MaxY;
  771.  
  772.  
  773. DESCRIPTION
  774.  
  775.         This  routine  allows you to draw a simple box in one command.
  776. It  draws  the  box  in APen color, in the current draw mode, with the
  777. current line pattern.
  778.  
  779.         (MinX,MinY)  are  the  upper  left  corner  of  the  box,  and
  780. (MaxX,MaxY) are the lower right.
  781.  
  782.         The pen is left at the upper left corner (MinX,MinY).
  783.  
  784. ;--------------------------------------------------------------------
  785.  
  786. NAME
  787.             MakeButton
  788. SYNOPSIS
  789.  
  790. MakeButton(Buffer,Image,Image2,Width,Height,Depth)
  791.              A0     A1    A2     D0    D1    D2
  792.  
  793.  
  794. struct  TwoImageGadget  *Buffer;
  795. char    *Image;     /* Pointer to the actual bitplane data */
  796. char    *Image2;    /* Pointer to the second image. */
  797. long    Width,Height,Depth;
  798.  
  799.  
  800.  
  801.  
  802. DESCRIPTION
  803.  
  804.     The  purpose  of  this  routine  is one similar to MakeGadget, but
  805. instead of using text for the button, it uses a graphic.  You supply a
  806. bitmap, and MakeButton will use it in it's rendering.
  807.  
  808.     You  may  have  either  one  or two images, the routine handles it
  809. routinely.   If you supply one image, then this sets GADGHCOMP, and if
  810. you  have two images, it sets GADGHIMAGE.  RELVERIFY is always set, so
  811. as  long  as  you  the  user  is  pressing  that gadget, the alternate
  812. highlight is shown.
  813.  
  814.     Buffer has room for two images.
  815.  
  816.     Image  is  a pointer to the actual image data, in CHIP memory, for
  817. this gadget.
  818.     Image2 is a pointer to the alternate image data.
  819.  
  820.     Width and Height make up the size of your image.
  821.  
  822.     Depth is how many bitplanes of data you've supplied.
  823.  
  824. BUGS
  825.     It's  not  really  a bug, but if your images aren't the same size,
  826. then one won't erase the other when it is drawn, so you may be showing
  827. an image with traces of the other one left there.
  828.  
  829. ;--------------------------------------------------------------------
  830.  
  831. NAME
  832.             MakeScrollBar
  833. SYNOPSIS
  834.  
  835. MakeScrollBar(Buffer,Flags,Size,X,Y)
  836.                 A0    D0    D1 D2 D3
  837.  
  838. struct ScrollBlock *Buffer;
  839. long    Flags,Size,X,Y;
  840.  
  841.  
  842. DESCRIPTION
  843.  
  844.     This is a special routine that creates a scrollbar (which consists
  845. of  a prop gadget and two arrows) and you handle it like it's a single
  846. gadget.   You  may  have  either a horizontal scrollbar, or a vertical
  847. scrollbar.   These scrollbars are very much like the ones in workbench
  848. window  borders.   These  use slightly different images on the arrows,
  849. however.
  850.  
  851.     The  way  you  determine  how  this set up and oriented is by flag
  852. combinations.   If  you wished to put a scrollbar in the bottom border
  853. of a window, then you would pass (in flags):
  854.  
  855.         Flags = (HORIZSLIDER | GRELBOTTOM | GRELWIDTH)
  856.  
  857.     If you wished it in the right border:
  858.  
  859.         Flags = (VERTSLIDER | GRELRIGHT | GRELHEIGHT)
  860.  
  861.     The  idea is to allow you to manipulate the scrollbar as though it
  862. were  a  single  gadget, not three.  If you pass confusing flags (like
  863. GRELBOTTOM|GRELHEIGHT) then it is undefined what will happen.
  864.  
  865.     If all you want is a simple scrollbar that doesn't size, then just
  866. set VERTSLIDER or HORIZSLIDER.
  867.  
  868. SEE
  869.  
  870.  
  871. ;--------------------------------------------------------------------
  872.  
  873. NAME
  874.             PurgeFiles
  875. SYNOPSIS
  876.     PurgeFiles(&FileRequesterStructure)
  877.                         A0
  878. DESCRIPTION
  879.     Clear  up  all  memory  and  file  locks  allocated  by  the  file
  880. requester.   This  routine must be called before your program exits if
  881. you  use  the  file requester with either FRQEXTSELECTM bit set or the
  882. FRQCACHINGM bit set.  The first bit is if you want the user to be able
  883. to select multiple files.  The file requester has to allocate a linked
  884. list  of  file  names which this function will purge.  The FRQCACHINGM
  885. bit  is set if you want the file requester to remember the contents of
  886. a directory between calls.
  887.  
  888.     This  routine can be called any time you want the buffers and file
  889. locks purge.
  890.  
  891. RETURNS
  892.     This routine does not return anything.
  893.  
  894. SEE
  895.     FileRequest
  896. BUGS
  897.     None known.
  898. EXAMPLE
  899.  
  900. main()
  901.     {
  902.     FileRequest(&FileRequesterStructure);
  903.  
  904.     .
  905.     .
  906.     .
  907.  
  908.     PurgeFiles(&FileRequesterStructure);
  909.     }
  910.  
  911.  
  912.  
  913. ;--------------------------------------------------------------------
  914.  
  915. NAME
  916.             GetFontHeightAndWidth
  917. SYNOPSIS
  918.  
  919. DESCRIPTION
  920.  
  921.         This allows you quick access to the font attributes set by the
  922. user  in preferences.  The font width is returned in D0 and the height
  923. is returned in D1.
  924.  
  925. RETURNS
  926. SEE
  927. BUGS
  928. EXAMPLE
  929.  
  930.  
  931.  
  932. ;--------------------------------------------------------------------
  933.  
  934. NAME
  935.             LinkGadget
  936. SYNOPSIS
  937.  
  938. LinkGadget(Buffer,String,nw, X, Y)
  939.              A0     A1   A3 D0 D1
  940.  
  941. struct  GadgetBlock *Buffer;
  942. char    *String;
  943. struct  NewWindow *nw;
  944. long    X,Y;
  945.  
  946. DESCRIPTION
  947.  
  948.     This  is  actually  a superset of the previous command MakeGadget.
  949. What  this  does  is automatically link the gadget into your NewWindow
  950. structure's gadget list.
  951.  
  952.         No registers are disturbed.
  953.  
  954. SEE
  955.     MakeGadget
  956. BUGS
  957.     n/a
  958.  
  959.  
  960.  
  961. ;--------------------------------------------------------------------
  962.  
  963. NAME
  964.             LinkStringGadget
  965. SYNOPSIS
  966. LinkStringGadget(Buffer,StringBuf,UndoBuf,nw, WidthBits,NumChars, X, Y)
  967.                    A0     A1        A2    A3     D0       D1     D2 D3
  968.  
  969. struct  StringBlock *Buffer;
  970. char    *StringBuf;
  971. char    *UndoBuf;
  972. struct  NewWindow *nw;
  973. long    WidthBits,NumChars,X,Y;
  974.  
  975. DESCRIPTION
  976.  
  977.     This  is  number 2 in the LinkGadget routines.  This one obviously
  978. links  the  string  gadget  to the window's gadget list.  In fact, the
  979. only  difference  between  this  and  the  MakeString  routine  is the
  980. addition of the NewWindow pointer.
  981.  
  982. SEE
  983.     MakeStringGadget
  984.  
  985.  
  986. ;--------------------------------------------------------------------
  987.  
  988. NAME
  989.             LinkPropGadget
  990. SYNOPSIS
  991.  
  992. LinkPropGadget(Buffer,nw, Width, Height, Flags, LeftEdge, TopEdge)
  993.                  A0   A3    D0     D1     D2       D3       D4
  994.  
  995. struct  PropBlock   *Buffer;
  996. struct  NewWindow   *nw
  997. long    Width,Height,Flags,LeftEdge,TopEdge;
  998.  
  999. DESCRIPTION
  1000.  
  1001.     Here  we  have a superset for MakeProp.  It works exactly the same
  1002. as  MakeProp,  except  that  it attaches the gadget to the head of the
  1003. list in the window.
  1004.  
  1005. SEE
  1006.     MakeProp
  1007.  
  1008.  
  1009. ;--------------------------------------------------------------------
  1010.  
  1011. FileRequester
  1012.  
  1013. NAME
  1014.     FileRequester  - bring up a file/font requester.
  1015.  
  1016. SYNOPSIS
  1017.     success = FileRequester(&FileRequesterStructure)
  1018.       D0                              A0
  1019.  
  1020. FUNCTION
  1021.     Bring  up  a  fully  intuitionized file/font requester (actually a
  1022. window) and let the user select a file/font.
  1023.  
  1024. INPUTS
  1025.     &FileRequesterStructure  -  pointer  to  an  initialized  (can  be
  1026. initialized mostly to zeroes) file requester structure.
  1027.  
  1028. RESULT
  1029.     Returns  TRUE  or FALSE to say whether the user selected a file or
  1030. not.   The  file name(s) or font selected are then found by looking at
  1031. the file requester structure whose address was passed.
  1032.  
  1033.     For  ideas  on  customizing the file requester for your particular
  1034. system  (thus  overriding the defaults used by programmers who use the
  1035. file requester) see the customizefile.asm file.
  1036.  
  1037. BUGS
  1038.     Problem  with  an  Intuition bug that messes up the current active
  1039. window  if  a  window  closes  when one of its string gadgets is still
  1040. active.   This bug show up if you run the file requester straight from
  1041. a CLI window and then exit it with Amiga-L.
  1042.     I have heard that it resets some window flags when run on a custom
  1043. screen,  but I believe this is a feature of Intuition, not of the file
  1044. requester.
  1045.  
  1046. SEE ALSO
  1047.     PurgeFiles
  1048.  
  1049.  
  1050.     The  file  requester  in  the  requester  library  allows to put a
  1051. powerful  and  easy  to  use  file requester into your programs with a
  1052. minimum of work and at a very small expense in program size.  The file
  1053. requester  was  designed  to be as easy as possible to call, while not
  1054. sacrificing power.
  1055.  
  1056.     To  get  the  file  requester to come up all you need to do (after
  1057. opening  the  requester  library of course) is to allocate space for a
  1058. FileRequester  structure  and  then  call  the file requester with the
  1059. address  of  this structure, with all fields initialized to zero, like
  1060. this:
  1061.  
  1062. struct FileRequester MyFileReqStruct;
  1063.  
  1064. success = FileRequester(&MyFileReqStruct);
  1065.  
  1066.     The function will return either one or zero for success or failure
  1067. respectively.
  1068.  
  1069.     You can specify what screen the file requester should appear on in
  1070. one  of  two  ways.  If you want it to appear on a custom screen, then
  1071. the  best  way  is  to  set  the  pr_WindowPtr  field  in your process
  1072. structure  to  point at one of the windows on your screen (this should
  1073. be  done anyway, so that DOS requesters appear on your custom screen).
  1074. This  field  is looked at by all functions in the requester library so
  1075. this  way  is the simplest method.  The other way, which overrides the
  1076. pr_WindowPtr  field  is to initialize the frq_Window field to point at
  1077. one of your windows.  If this field is non-zero, it is used instead of
  1078. the pr_WindowPtr field of your process structure.  Important note:  It
  1079. is  VERY  important  that you reset the pr_WindowPtr field back to its
  1080. original  value  before  your  program  exits.  If you don't, the next
  1081. program run may try to open a requester window on a now closed screen.
  1082.  
  1083.     The  file  requester  was  carefully  designed so that it could be
  1084. called  without  having  to  initialize  very  many  fields.   This is
  1085. demonstrated  by  seeing  that  it  is  possible  to  call  it without
  1086. initializing any fields.  There are a few fields that are necessary to
  1087. actually  get  any  use  out  of  it,  but  very  view.  Those few are
  1088. documented in the following paragraph.
  1089.  
  1090.     Although  you can bring the file requester up without initializing
  1091. any  fields there are a couple of fields that you will definitely want
  1092. to  initialize.   The  file  requester isn't much use unless you get a
  1093. file  name back out of it, and for this you need to initialize the Dir
  1094. and  File  fields.   These two fields should point to character arrays
  1095. that  are,  respectively,  DSIZE+1  and FCHARS+1 bytes long.  When the
  1096. file  requester  is first run the file requester looks in these arrays
  1097. for  the  default  directory  and file names and if the user selects a
  1098. file  name  the  directory  and  file  name are copied back into these
  1099. arrays.  You will probably want to initialize the Title field with the
  1100. message  that you want to have appear at the top of the file requester
  1101. window.
  1102.  
  1103.     If  you initialize the PathName field (it should point an array of
  1104. at least DSIZE+FCHARS+2 characters) then when the user selects a file,
  1105. the complete path name will be put into this array.
  1106.  
  1107.     The Window field is used to specify what window the file requester
  1108. is associated with.  This is used to get the file requester to show up
  1109. on  a  custom  screen.   Generally  this  field should be unnecessary.
  1110. There  is a variable provided in a process structure which is used for
  1111. this purpose.  Any program that opens a custom screen and uses any DOS
  1112. functions  should set the pr_Window pointer in their process structure
  1113. to  a  pointer  to their window so that DOS requesters will show up on
  1114. their  custom  screen.   If  you do this, then the file requester will
  1115. also  show  up  on  your custom screen.  If you are not using a custom
  1116. screen  then you don't need to set the pr_Window pointer or the Window
  1117. field  in  the  file  requester  structure.   Note:  If you do set the
  1118. pr_Window  structure in the process structure, be sure to return it to
  1119. its old value before your program exits.
  1120.  
  1121.     If  the  extended  select  bit  is set in the Flags field then the
  1122. MaxExtendedSelect  fields  specifies  the maximum number of files that
  1123. the user can select.  This is ignored if the extended bit isn't set in
  1124. the Flags field.
  1125.  
  1126.     numlines and numcolumns specify the maximum size that the file box
  1127. will  be in characters.  If the system is low on memory, or the screen
  1128. is  too  small,  these will be shrunk as necessary.  devcolumns is the
  1129. number of columns of characters wide that the device box will be.
  1130.  
  1131.     The  Flags field can currently contain seven different flags.  The
  1132. first  flag,  FRQSHOWINFOM,  specifies  whether  or not '*.info' files
  1133. (files  containing information for icons) should be filtered out.  The
  1134. default is for them to be filtered.
  1135.  
  1136.     The  FRQEXTSELECTM  flags  specifies  whether  extended  select is
  1137. wanted.   If  you  set this flag then you should probably also set the
  1138. MaxExtendedSelect  field.   If  you  don't  then the maximum number of
  1139. files  the  user  will be able to select will be 65536, which is a bit
  1140. high  for  most  purposes.  Note:  If you use this bit then you _must_
  1141. call  PurgeFiles()  with  the  address of your FileRequester structure
  1142. after  the  last time you call the file requester, in order to free up
  1143. any  memory  used  in  the  extended select structures.  When the user
  1144. selects  multiple files, a linked list of the file names selected (not
  1145. including the directory name) will appear in the ExtendedSelect field.
  1146. The  list  is a linked list of ESStructures.  The directory name which
  1147. should  be  prepended  to  all of these names will appear in the array
  1148. pointed to by the Dir field.
  1149.  
  1150.     The  FRQCACHINGM  flag  specifies  whether  or not directories are
  1151. cached  from  one  call  to  the next.  This is a very handy features,
  1152. especially  for those who lack hard drives.  However, if this features
  1153. is  used, you _must_ call the PurgeFiles() routine with the address of
  1154. your  FileRequester  structure  after  the last time you call the file
  1155. requester, in order to free up any memory used in caching.
  1156.  
  1157.     As  well  as being a file requester, this routine can be used as a
  1158. font requester too.  Just set the FRQGETFONTSM flags to turn it into a
  1159. font  requester.   You  should  also  put the name 'fonts:' in the Dir
  1160. array.   The file/font requester will return a one or zero for success
  1161. or  failure as usual, the font name will be returned in the File array
  1162. and  the  font  size  and  style will be returned in the FontYSize and
  1163. FontStyle  fields.   Note  that  the font requester allows the user to
  1164. change  the  directory  where  the  fonts are read from.  Although you
  1165. should  put  'fonts:' there, you should allow for the possibility that
  1166. the  user  might  change  the  directory.  They might, perhaps, have a
  1167. separate  disk  full  of  fonts.   The simplest way to deal with fonts
  1168. coming  from  different  directories,  is  to  set  the PathName field
  1169. instead of the Dir field.  You can then use the string in the PathName
  1170. field  (which  will  contain  the directory and font name) as the font
  1171. name.   If  you  don't  do this, then you have to concatenate the font
  1172. name  and  the  directory  name  yourself.   If  you  use the PathName
  1173. variable  then  it  is quite reasonable to leave the File field blank,
  1174. since  all  the information you need can be obtained from the PathName
  1175. string.
  1176.  
  1177.     The  FRQINFOGADGETM flag specifies whether or not a hide/show info
  1178. gadget should appear on the file requester.  This lets the user toggle
  1179. the  state  of  the  FRQSHOWINFOM flag to decide whether or not to let
  1180. '*.info'  files  show  up.  This is not recommended for most programs,
  1181. since  most  users  have  no  reason  to  look at '*.info' files.  The
  1182. default is to _not_ have this gadget show up.
  1183.  
  1184.     The FRQHIDEWILDSM flag specifies whether or not to have 'show' and
  1185. 'hide'  string  gadgets.   These gadgets let the user use wildcards to
  1186. specify  which  files  should  show  up.  All files are first compared
  1187. against  the 'show' gadget.  If they fail the comparison, they are not
  1188. displayed.  Then they are compared against the 'hide' gadget.  If they
  1189. match  here then they are not displayed.  If the gadgets are empty, no
  1190. comparisons  are done.  Important note:  Even if these gadgets are not
  1191. displayed,  the comparisons are still done on the data which is in the
  1192. Hide  and  Show  fields of the file requester structure.  The standard
  1193. AmigaDOS wildcards (including '#', '?', '|' and '*') are supported.
  1194.  
  1195.     Normally  the  file  requester  appears  centered  under the mouse
  1196. pointer.   If  you would like to specify its opening position you must
  1197. set   the   ABSOLUTEXYM   flag  and  then  put  the  x,y  position  in
  1198. WindowLeftEdge and WindowTopEdge.
  1199.  
  1200.     If you feel that the file requester's cached directories (selected
  1201. by  FRQCACHINGM)  should  be  purged  whenever  the directory has been
  1202. changed,  then  set  FRQCACHEPURGEM  field and the file requester will
  1203. check the dates whenever it is opened.
  1204.  
  1205.     If you feel that the file requester should never cache directories
  1206. unless  it  manages  to  read  in the entire directory before the user
  1207. sends  it  away,  then  set  the FRQNOHALFCACHEM flag.  This flag will
  1208. cause  the file requester to automatically flush any incompletely read
  1209. directories when it exits.
  1210.  
  1211.     If  you  would  like your directories to appear in 'natural' order
  1212. instead of alphabetically sorted, set the FRQNOSORTM flag.
  1213.  
  1214.     If you would like the file requester to appear without a drag bar
  1215. or depth arrangement gadgets, set the FRQNODRAGM flag.
  1216.  
  1217.     If  you  are using the file requester to select a filename to save
  1218. to,  you  should set the FRQSAVINGM flag.  Similarly, if you are using
  1219. the  file  requester to select a filename to load from, you should set
  1220. the  FRQLOADINGM flag.  These flags are not currently used by the file
  1221. requester,  but  they  may  be  used in the future.  They also make it
  1222. easier  for  people who want to personalize the file requester to make
  1223. it behave differently for loading vs.  saving.
  1224.  
  1225.  
  1226.     The  various  color  fields  let  you  specify  the colors of many
  1227. aspects of the file requester.  If they are left as zero then the file
  1228. requester uses various non-zero certain default values for them.
  1229.  
  1230.     The  WindowLeftEdge  and  WindowTopEdge  fields are covered in the
  1231. section on the ABSOLUTEXYM flag.
  1232.  
  1233.     The  FontYSize  and FontStyle fields are covered in the section on
  1234. the FRQGETFONTSM flag.
  1235.  
  1236.     The  ExtendedSelect  field  is  covered  in  the  section  on  the
  1237. FRQEXTSELECTM flag.
  1238.  
  1239.     The  Hide  and  Show  fields  are  covered  in  the section on the
  1240. FRQHIDEWILDSM flag.
  1241.  
  1242. Set this bit if you are selecting a file to save to.
  1243. Set this bit if you are selecting a file(s) to load from.
  1244. These two bits (save and load) aren't currently used for
  1245. anything, but they may be in the future, so you should
  1246. remember to set them.  Also, these bits make it easier if
  1247. somebody wants to customize the file requester for their
  1248. machine.  They can make it behave differently for loading
  1249. vs saving.
  1250.  
  1251.     The  four  BufferPos  and  DispPos  variables  are  copies  of the
  1252. equivalent  variables  from  the four string gadgets.  This is so that
  1253. when  the  file  requester goes away and then is brought up again, the
  1254. cursor in the string gadgets will appear in the same places as before.
  1255. These fields should not need to be touched by the programmer.
  1256.  
  1257.     The  rest  of the fields are private.  Don't go touching them.  We
  1258. guarantee  to  move them around and change their meaning, just to make
  1259. sure  that  nobody tries to use them.  They are largely concerned with
  1260. keeping  track  of  memory  used in directory caching.  This memory is
  1261. freed  with  the  PurgeFiles() routine.  That's all you should need to
  1262. know.
  1263.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268. ;--------------------------------------------------------------------
  1269.  
  1270. RealTimeScroll
  1271.  
  1272. NAME
  1273.     RealTimeScroll  -  do the calculations necessary for a responsive,
  1274. pixel resolution, real time scroll routine.
  1275.  
  1276. SYNOPSIS
  1277.     RealTimeScroll(&ScrollStruct);
  1278.                          A0
  1279.  
  1280. FUNCTION
  1281.     Make  the  implementation  of  real time scrolling area easier and
  1282. make the real time scrolling area more responsive to the user by doing
  1283. pixel resolution scrolling and by checking the current position of the
  1284. scroll  bar  in mid scroll.  This routine calculates how far to scroll
  1285. each  time  and calculates which lines of text, graphics etc.  need to
  1286. be redrawn to fill in the empty area.
  1287.  
  1288. INPUTS
  1289.     &ScrollStruct - pointer to an initialized scroll structure.
  1290.  
  1291. RESULT
  1292.     This routine returns no result code.
  1293.  
  1294. BUGS
  1295.     None known
  1296.  
  1297. SEE ALSO
  1298.     n/a
  1299.  
  1300.  
  1301.     It is relatively easy to implement a real time scrolling area, but
  1302. the most obvious implementations suffer from a lack of responsiveness.
  1303. Typically  the  routines  look  at  where the scroll bar is, calculate
  1304. where  to  scroll  to,  scroll  there  in  several  jumps  to make the
  1305. scrolling  look smooth, and the examine the scroll bar again to see if
  1306. it  has  moved.  This means that there are periods, perhaps annoyingly
  1307. long,  where  the  program may be scrolling in one direction while the
  1308. scroll  bar is being dragged in another.  The answer is to examine the
  1309. scroll  bar  to  find out the desired location, scroll partway towards
  1310. the  destination and then recheck the scroll bar's location.  This can
  1311. greatly  increase  the  responsiveness,  since the program is checking
  1312. after  every  ScrollRaster()  call,  instead of after a dozen or more.
  1313. However,  the  calculations,  especially  of  which  lines  need to be
  1314. refreshed  and  where, get somewhat more complicated.  This routine is
  1315. designed  to  simplify this situation by taking care of as many of the
  1316. messy details as possible.
  1317.  
  1318.     First   you   must   initialize   the   scroll   structure.    The
  1319. TopEntryNumber, NumEntries and NumLines fields describe where the data
  1320. is  currently.   NumEntries  is  the number of lines of data in total,
  1321. NumLines  is  the number of lines that are visible, and TopEntryNumber
  1322. is the line number of the first line visible (it therefore ranges from
  1323. zero to NumEntries - 1).
  1324.  
  1325.     LineSpacing  is  the  number of pixels high that each line of data
  1326. is.   For  text  this  will  typically be eight or nine (for eighty or
  1327. sixty  column  topaz).   This  can  be  set  to  one  if  your data is
  1328. continuous (as in the case of some graphics).
  1329.  
  1330.     PropGadget  is a pointer to the prop gadget which is being used to
  1331. control this scroll area.
  1332.  
  1333.     RedrawAll  is  a  pointer  to  a  function that you must supply to
  1334. redraw the entire visible window.  This routine is called whenever the
  1335. user  gets  so far ahead of the scroll routine that scrolling to where
  1336. the  users  wants  to  be  would  take  too long.  Before calling this
  1337. routine,  the  ScrollStruct that was passed to this routine is updated
  1338. with  the  desired TopEntryNumber so that your routine will know which
  1339. data to redraw.
  1340.  
  1341.     ReadMore is an optional routine that will usually not be used.  It
  1342. is  used  if more data is being added while the scrolling is going on.
  1343. This  is  used,  for  instance,  by  the  FileRequest in the requester
  1344. library, to continue attempting to read the directoy while the user is
  1345. scrolling.   Leave  this set to zero if you don't need it.  It is only
  1346. called  when no scrolling is being done, but the user has not released
  1347. the scroll bar.
  1348.  
  1349.     ScrollAndDraw  is the most important routine.  This routine, which
  1350. you  must  supply,  is called whenever the data must be scrolled.  The
  1351. actual  scrolling  and  redrawing of the data is done by this routine,
  1352. but because the scroll amount, the lines to be drawn and the number of
  1353. lines  to  be  drawn are passed to this routine, the routine is fairly
  1354. simple.  Four parameters are passed to this routine:
  1355.  
  1356. ScrollAndDraw(firstlinenum, firstliney, scrollamount, numlines, scrollstruct);
  1357.                   D0            D1           D2          D3         A0
  1358.     All  four parameters are passed as longs, both on the stack and in
  1359. D0-D3 and A0, so that the routine can easily be written in either C or
  1360. assembler.
  1361.  
  1362.     When the ScrollAndDraw, ReadMore or RedrawAll routines are called,
  1363. A4,  A5  and  A6  all  contain  the  same  values  they contained when
  1364. RealTimeScroll  was  called.   This allows programs written in C using
  1365. the  small  data  model  to be able to access their data properly from
  1366. these  routines without any special work.  All other registers (except
  1367. those that are used to pass parameters in) could contain anything.
  1368.  
  1369.  
  1370.  
  1371.  
  1372. ;--------------------------------------------------------------------
  1373.  
  1374.  
  1375.  
  1376. TextRequest
  1377.  
  1378. NAME
  1379.     TextRequest  - bring up a text requester with one to three gadgets
  1380. and get a response.
  1381.  
  1382. SYNOPSIS
  1383.     result = TextRequest(&TRStructure);
  1384.       D0                      A0
  1385.  
  1386. FUNCTION
  1387.     Bring  up  a requester (actually a window) containing a message to
  1388. the  user  and  give  him  a  choice  of  from  one to three different
  1389. responses.   The  window  automatically  sizes  to  fit  the  text and
  1390. printf() style formatting can be used by TextRequest() to generate the
  1391. message to the user.
  1392.  
  1393. INPUTS
  1394.     &TRStructure - pointer to an initialized text requester structure.
  1395.  
  1396. RESULT
  1397.     Returns  either  zero,  one  or two, depending on which gadget the
  1398. user  clicks  on.   All  of  the  gadgets  are  optional,  so that the
  1399. requester  can  be  used  to  bring up requesters that give the user a
  1400. message,  without demanding an answer, by having only a single gadget.
  1401. The  gadget  in  the  lower  right  hand  corner (the negative gadget)
  1402. returns a zero, the gadget in the lower left hand corner (the positive
  1403. gadget)  returns a one and the gadget in the middle returns a two.  If
  1404. none  of these three gadgets are requested, a close gadget is attached
  1405. to the window and it returns a zero.
  1406.  
  1407. BUGS
  1408.     If  any  line  of  the  text  to  be printed is too long, then the
  1409. requester  will  attempt  to open up an impossibly large window, which
  1410. will fail and the requester will return a zero.
  1411.     The  buffer used for formatting the text is 5000 bytes long, so no
  1412. messages can be longer than this.
  1413.  
  1414. SEE ALSO
  1415.     SimpleRequest
  1416.     TwoGadRequest
  1417.  
  1418.  
  1419.     The  purpose  of  this  routine  is  to  make  it as easy to print
  1420. formatted  messages  in  intuitionized window with gadgets as it is to
  1421. print  them  on the CLI screen.  For maximum ease of use, at a loss of
  1422. flexibility,  please see the functions SimpleRequest and TwoGadRequest
  1423. which  are  simply  glue  code functions to make calling TextRequest a
  1424. trivial matter.
  1425.  
  1426.     If  you want the text requester to appear on a custom screen, then
  1427. you must set the pr_WindowPtr field in your process structure to point
  1428. at  one  of the windows on your screen (this should be done anyway, so
  1429. that  DOS  requesters  appear  on  your custom screen).  This field is
  1430. looked at by all functions in the requester library so this way is the
  1431. simplest method.  Important note:  It is VERY important that you reset
  1432. the  pr_WindowPtr field back to its original value before your program
  1433. exits.  If you don't, the next program run may try to open a requester
  1434. window on a now closed screen.
  1435.  
  1436.     The  structure  whose  address  is  passed to this routine must be
  1437. initialized first.
  1438.  
  1439.     The  Text field is initialized with the body of the text you would
  1440. like  displayed.  This text can contain both printf() style formatting
  1441. and  end  of  line characters ('\n' in C, ascii 10 in assembler).  The
  1442. printf()  style formatting, is expanded out into the final text string
  1443. using  the  parameter  list which is pointed to by the Controls field.
  1444. Line  feeds  are  used, as usual, to specify a new line, thus allowing
  1445. very  long  and  complex  messages  to  be  displayed.   The  are some
  1446. limitations  on  the  types  of  printf() formatting that can be used.
  1447. Since the RawDoFmt() function of the ROM is used to do the formatting,
  1448. only   functions   supported   by   it  can  be  used.   For  complete
  1449. documentation,  see  the documentation of the RawDoFmt() command.  The
  1450. main  things  to be aware of is that floating point numbers can not be
  1451. printed,  and,  if  you  are using a compiler that uses thirty-two bit
  1452. ints  then  we  will  have to specify '%ld' to print an int, since the
  1453. RawDoFmt command assumes an int size of sixteen bits.
  1454.  
  1455.     The Controls field points to a list of parameters, one for each of
  1456. the  '%'  parameters in the Text field.  Normally these will be pushed
  1457. on  to the stack and the stack pointer copied into the Controls field.
  1458. The first parameter used (the first one to occur in the string) should
  1459. be  at  the beginning of the list, that is, at the lowest address, the
  1460. one pointed at by the Controls parameter.
  1461.  
  1462.     The Window field can be used to specify what screen you would like
  1463. the requester to appear on.  This field is usually not necessary since
  1464. the same information can be conveyed in the pr_WindowPtr field of your
  1465. process  structure.   However  this  field  was  left  in  so that the
  1466. TextRequest  function  could  be  called  from  a  task (which lacks a
  1467. process  structure and therefore a pr_WindowPtr field).  If this field
  1468. is  non-zero or if the calling program is a task then this field takes
  1469. precedence over the pr_WindowPtr field.
  1470.  
  1471.     MiddleText,  PositiveText  and NegativeText are the pieces of text
  1472. used  for  the  three gadgets.  These three gadgets, when present, are
  1473. placed   in  the  middle,  the  left  and  the  right  of  the  window
  1474. respectively.   All  three  gadgets are placed along the bottom of the
  1475. window.   All of the gadgets are optional.  If a gadget is not wanted,
  1476. the  text  pointer  should be set to zero.  The values returned if the
  1477. user  clicks  on these gadgets are two, one or zero, respectively.  If
  1478. none  of  the gadgets are present (if all of the text fields are zero)
  1479. then  a  standard  CLOSEWINDOW gadget is attached to the window.  This
  1480. gadget returns a zero.
  1481.  
  1482.     The  requester  attempt  to  appear so that the negative gadget is
  1483. underneath  the  mouse pointer.  If the negative gadget is not present
  1484. it will attempt to appear so that a different gadget is underneath the
  1485. mouse  pointer.   This is to make it as convenient as possible for the
  1486. user  to  respond  to,  and  especially  to respond negatively to, the
  1487. requester.
  1488.  
  1489.     In  addition  to  responding  to  the  requester  with  the mouse,
  1490. keyboard  shortcuts are available.  The user can type ESC, 'N', 'Q' or
  1491. 'B'  as  a  shortcut to clicking on the negative gadget.  The user can
  1492. type  'Y'  or 'V' as a shortcut to clicking on the positive gadget and
  1493. can type 'M' as a shortcut to clicking on the middle gadget.
  1494.  
  1495.     The  Title  field  of  the structure should either point to a null
  1496. terminated  string  to  be  used in the windows title bar or should be
  1497. null.
  1498.  
  1499.     The  KeyMask  field  is  used  to  regulate  the  use  of keyboard
  1500. shortcuts.  The qualifier field of all keyboard messages is ANDed with
  1501. this  field,  and  the  keypress  is  ignored  if  the result is zero.
  1502. Therefore,  to enable all keypresses to be used as keyboard shortcuts,
  1503. initialize  this  field to $FFFF.  To turn off the keyboard shortcuts,
  1504. initialize  this  field to 0.  To force the user to hold down the left
  1505. or right amiga key, initialize this field to AMIGAKEYS.
  1506.  
  1507.     The  textcolor,  detailcolor  and  blockcolor  fields  can be left
  1508. unitialized (ie; set to zero) if you wish, in which case the requester
  1509. will  use  the  default values of one, zero and one respectively.  The
  1510. textcolor  field  is used for the color of the actual text message and
  1511. the detail and block color fields are simple copied into the fields of
  1512. the same name in the new window structure.
  1513.  
  1514. ;--------------------------------------------------------------------
  1515.  
  1516.  
  1517. SimpleRequest
  1518.  
  1519. NAME
  1520.     SimpleRequest - bring up a text requester and wait for the user to
  1521. acknowledge it.
  1522.  
  1523. SYNPOSIS
  1524.     SimpleRequest(string, parameterlist, , ,)
  1525.                     A0        A1
  1526.  
  1527. FUNCTION
  1528.     Bring  up  a requester (actually a window) containing a message to
  1529. the  user  and  wait  for  the  user  to  acknowledge  it.  The window
  1530. automatically  sizes to fit the text and printf() style formatting can
  1531. be used by TextRequest() to generate the message to the user.
  1532.  
  1533.                                  --------
  1534.  
  1535.     This  is  actually just if you are going to call the gluecode.  If
  1536. you  are  using  Lattice  C,  (version 5.00+) you can use pragmas, and
  1537. don't  need  glucode.   This  has the slight drawback of also removing
  1538. SimpleRequest()  and TwoGadRequest(), so here they are in C so you can
  1539. put them in your code:
  1540.  
  1541. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1542.  
  1543. void __stdargs SimpleRequest(char *str,...)
  1544.     {
  1545.     va_list ap;
  1546.     struct TRStructure trs;
  1547.  
  1548.     va_start(ap,str);
  1549.  
  1550.     trs.Text = str;
  1551.     trs.Controls = ap;
  1552.     trs.Window = 0;
  1553.     trs.MiddleText = 0;
  1554.     trs.PositiveText = 0;
  1555.     trs.NegativeText = "Resume";
  1556.     trs.Title = "Ahem...";
  1557.     trs.KeyMask = 0xFFFF;
  1558.     trs.textcolor = 2;
  1559.     trs.detailcolor = 3;
  1560.     trs.blockcolor = 2;
  1561.     trs.versionnumber = REQVERSION;
  1562.     trs.Timeout = 0;    /* you could put a timeout here if you wanted */
  1563.     trs.AbortMask = 0;    /* If you wanted to abort this requester from another */
  1564.                         /* process, pass the mask for Signal() in this element. */
  1565.                         /* Then just Signal() the process that brought up the requester */
  1566.     trs.rfu1 = 0;
  1567.     TextRequest(&trs);
  1568.     va_end(ap);
  1569.     }
  1570.  
  1571. short __stdargs TwoGadRequest(char *str,...)
  1572.     {
  1573.     va_list ap;
  1574.     struct TRStructure trs;
  1575.     short res;
  1576.  
  1577.     va_start(ap,str);
  1578.  
  1579.     trs.Text = str;
  1580.     trs.Controls = ap;
  1581.     trs.Window = 0;
  1582.     trs.MiddleText = 0;
  1583.     trs.PositiveText = "  OK  ";
  1584.     trs.NegativeText = "CANCEL";
  1585.     trs.Title = "Ahem...";
  1586.     trs.KeyMask = 0xFFFF;
  1587.     trs.textcolor = 2;
  1588.     trs.detailcolor = 3;
  1589.     trs.blockcolor = 2;
  1590.     trs.versionnumber = REQVERSION;
  1591.     trs.Timeout = 0;    /* you could put a timeout here if you wanted */
  1592.     trs.AbortMask = 0;    /* If you wanted to abort this requester from another */
  1593.                         /* process, pass the mask for Signal() in this element. */
  1594.                         /* Then just Signal() the process that brought up the requester */
  1595.     trs.rfu1 = 0;
  1596.  
  1597.     res = TextRequest(&trs);
  1598.     va_end(ap);
  1599.     return(res);
  1600.     }
  1601.  
  1602.  
  1603. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1604.  
  1605.  
  1606. INPUTS
  1607.     string  -  a  null  terminated  string,  containing printf() style
  1608. formatting commands if desired.
  1609.     parameterlist - the parameters corresponding to the printf() style
  1610. formatting  commands  in  the string.  In C these are listed after the
  1611. control  string,  exactly as with printf().  In assembler, the address
  1612. of the list of parameters is put in A1.
  1613.  
  1614. RESULT
  1615.     No result code is returned.
  1616.  
  1617. BUGS
  1618.     See TextRequest
  1619.  
  1620. SEE ALSO
  1621.     TextRequest
  1622.     TwoGadRequest
  1623.  
  1624.  
  1625.     This  function was designed to make it as easy to give messages to
  1626. the  user  and await acknowledgment in an intuition style requester as
  1627. it  is  using  printf() and getc().  Simply replace almost any call to
  1628. printf()  with a call to SimpleRequest and a requester will appear and
  1629. not  disappear until the user acknowledges it (either with a keystroke
  1630. or with the mouse).
  1631.  
  1632.     Example:
  1633.         SimpleRequest("There  have  %d  changes  made  to this file.",
  1634.                         numchanges);
  1635.  
  1636.     Please  see  the  TextRequest  documentation for further important
  1637. details.   This  routine  is simply a few lines of assembler glue code
  1638. for  the TextRequest routine.  The TextRequest routine is a little bit
  1639. more   complicated   to   use,  but  it  allows  correspondingly  more
  1640. flexibility.   It  is  fairly  simple to modify the glue code to allow
  1641. still more high level entry points to the TextRequest routine.
  1642.  
  1643.  
  1644.     This  is  a  complete  program that makes use of the SimpleRequest
  1645. function  from  assembler,  and  demonstrates a few of the features of
  1646. Format (which is used by SimpleRequest).
  1647.  
  1648. ;--------------------------------------------------------------------
  1649. ;-----CUT HERE---------------CUT HERE--------------------------------
  1650. ;--------------------------------------------------------------------
  1651.  
  1652.     INCLUDE "libraries/reqbase.i"
  1653.  
  1654.     public  SimpleRequest
  1655.     public  _ReqBase,_main
  1656.  
  1657. ;--------------------------------------------------------
  1658. ; This file should be linked with reqglue.o, for the SimpleRequest
  1659. ;function.
  1660. ;--------------------------------------------------------
  1661.  
  1662. SYS MACRO
  1663.     XREF    _LVO\1
  1664.     JSR _LVO\1(A6)
  1665.     ENDM
  1666.  
  1667. ;--------------------------------------------------------
  1668.  
  1669.  
  1670. _main
  1671.     OpenReq
  1672. mystart
  1673.  
  1674.     MOVE.L  A6,A5
  1675.     MOVE.L  A6,_ReqBase
  1676.  
  1677.  
  1678.     PEA     string
  1679.     MOVE.L  #$C0FFEE,-(SP)
  1680.     MOVE.W  #$1CE,-(SP)
  1681.     MOVE.W  #'B',-(SP)
  1682.     MOVE.L  #-12345,-(SP)
  1683.     MOVE.L  SP,A1
  1684.     LEA     Text,A0
  1685.     JSR     SimpleRequest
  1686.  
  1687.     LEA     16(SP),SP
  1688.  
  1689.     MOVE.L  A5,A1
  1690.     MOVE.L  4,A6
  1691.     SYS     CloseLibrary
  1692.  
  1693.     MOVEQ   #0,D0
  1694.     RTS
  1695. string
  1696.     DC.B    "This is a string.",0
  1697. Text
  1698.     DC.B    "A long (signed) decimal is: %ld,",10
  1699.     DC.B    "a character is: %c,",10
  1700.     DC.B    "a 16 bit hex val might be: %x, ",10
  1701.     DC.B    "a register-style format 32 bit hex: $%08lx,",10
  1702.     DC.B    "and a string might read: `%s'.",0
  1703.  
  1704.     dseg
  1705.  
  1706. _ReqBase    DC.L    0   ;The SimpleRequest function in the glue code
  1707.                         ;needs this variable.
  1708.  
  1709.     END
  1710.  
  1711. ;--------------------------------------------------------------------
  1712. ;-----CUT HERE---------------CUT HERE--------------------------------
  1713. ;--------------------------------------------------------------------
  1714.  
  1715.  
  1716.  
  1717.  
  1718. ;--------------------------------------------------------------------
  1719.  
  1720.  
  1721.  
  1722. TwoGadRequest
  1723.  
  1724. NAME
  1725.     TwoGadRequest - bring up a text requester and wait for the user to
  1726. acknowledge it.
  1727.  
  1728. SYNPOSIS
  1729.     result = TwoGadRequest(string, parameterlist, , ,)
  1730.                              A0        A1
  1731.  
  1732. FUNCTION
  1733.     Bring  up  a requester (actually a window) containing a message to
  1734. the user and wait for the user to click on either the OK or the CANCEL
  1735. gadget.   The  window automatically sizes to fit the text and printf()
  1736. style  formatting can be used by TextRequest() to generate the message
  1737. to the user.
  1738.  
  1739.                                    -----
  1740.  
  1741.     See SimpleRequest() above if you are using Lattice 5.00+.
  1742.  
  1743. INPUTS
  1744.     string  -  a  null  terminated  string,  containing printf() style
  1745. formatting commands if desired.
  1746.     parameterlist - the parameters corresponding to the printf() style
  1747. formatting  commands  in  the string.  In C these are listed after the
  1748. control  string,  exactly as with printf().  In assembler, the address
  1749. of the list of parameters is put in A1.
  1750.  
  1751. RESULT
  1752.     Either  one  or  zero  is  returned, depending on whether the user
  1753. selected, respectively, the OK or the CANCEL gadget.
  1754.  
  1755. BUGS
  1756.     See TextRequest
  1757.  
  1758. SEE ALSO
  1759.     TextRequest
  1760.     SimpleRequest
  1761.  
  1762.  
  1763.     This  function was designed to make it as easy to give messages to
  1764. the  user  and get a response in an intuition style requester as it is
  1765. using printf() and getc().  Simply replace almost any call to printf()
  1766. with  a  call  to  SimpleRequest  and  a requester will appear and not
  1767. disappear  until  the  user responds to it (either with a keystroke or
  1768. with the mouse).
  1769.  
  1770.     Example:
  1771.         if (TwoGadRequest("There have %d changes made to this file.\n"
  1772.                           "O.K. to continue?",
  1773.                           numchanges))
  1774.             exit(10);
  1775.  
  1776.     Please  see  the  TextRequest  documentation for further important
  1777. details.   This  routine  is simply a few lines of assembler glue code
  1778. for  the TextRequest routine.  The TextRequest routine is a little bit
  1779. more   complicated   to   use,  but  it  allows  correspondingly  more
  1780. flexibility.   It  is  fairly  simple to modify the glue code to allow
  1781. still more high level entry points to the TextRequest routine.
  1782.  
  1783.  
  1784.  
  1785. -------------------------------------------------------------------
  1786. NAME
  1787.     GetString
  1788.  
  1789. BOOL = GetString(buffer, title, window, visiblechars, maxchars)
  1790. D0                 A0      A1     A2        D0          D1
  1791.  
  1792. DESCRIPTION
  1793.     This  routine allows you to bring up a nice intuition style string
  1794. requester  in  its  own window and get a single line of input from the
  1795. user in just a one line function call.
  1796.  
  1797.     buffer  points  to  the  a buffer containing the string which will
  1798. appear  when  the string gadget first appears and it is also where the
  1799. result will be put, if this routine returns TRUE.
  1800.     Title  is  a pointer to a null terminated string that will be used
  1801. for the window title.
  1802.     Window  can  be  used  to  specify  what screen you would like the
  1803. requester  to  appear on.  You simply put a window pointer in it (or a
  1804. zero if you want the requester to appear on the workbench screen).  If
  1805. you have already set your pr_WindowPtr then you can simply pass a zero
  1806. for the window pointer and the pr_WindowPtr value will be used.
  1807.     visiblechars  specifies  how  many  characters  should actually be
  1808. visible at one time.
  1809.     maxchars   specifies   how  long  the  buffer  is,  including  the
  1810. terminating zero.
  1811.  
  1812. RETURNS
  1813.     This  routine returns true or false, depending on whether the user
  1814. clicked  on  the  cancel  gadget  (FALSE)  or clicked on the OK gadget
  1815. (TRUE)  or clicked on the close window gadget (FALSE) or hit return in
  1816. the string gadget (TRUE).
  1817.  
  1818. BUGS
  1819.     None known.
  1820.  
  1821.  
  1822.  
  1823. -------------------------------------------------------------------
  1824. NAME
  1825.     GetLong
  1826.  
  1827. BOOL = GetLong(&GetLongStruct)
  1828. D0                   A0
  1829.  
  1830. DESCRIPTION
  1831.     This  routine allows you to bring up a nice intuition style string
  1832. requester  in  its  own  window and get a single signed thirty-two bit
  1833. number  from the user in just a one line function call (although a few
  1834. fields in the structure must be initialized first).
  1835.  
  1836.     The  GetLongStruct  contains  fields  for  letting you specify the
  1837. title  bar  message,  the  default  value  that  should  appear in the
  1838. requester  and  the maximum and minimum values that the routine should
  1839. allow  to  be  entered.   If  the  routine  returns  TRUE  (indicating
  1840. successful  entry  of  a  number)  then  the result is returned in the
  1841. result field of the structure.
  1842.     The window field can be used to specify what screen you would like
  1843. the requester to appear on.  You simply put a window pointer in it (or
  1844. a  zero  if you want the requester to appear on the workbench screen).
  1845. If  you  have  already set your pr_WindowPtr then you can simply leave
  1846. the window field zeor and the pr_WindowPtr value will be used.
  1847.  
  1848. RETURNS
  1849.     This  routine  returns  TRUE  or  FALSE  (1 or 0) in D0 to specify
  1850. whether  or  not  the  user  successfully  entered  a number.  If this
  1851. routine  returns TRUE then you can find the result in the result field
  1852. of the GetLongStruct whose address you passed to GetLong.
  1853.  
  1854.  
  1855.  
  1856. -------------------------------------------------------------------
  1857. RawKeyToAscii
  1858.  
  1859. SYNOPSIS
  1860.  
  1861.  key = RawKeyToAscii(Code,Qualifier,IAddress)
  1862.  D0                   D0     D1        A0
  1863.  
  1864.  UWORD  Code,Qualifier;
  1865.  APTR   IAddress;
  1866.  
  1867. FUNCTION
  1868.  
  1869.     Have you ever wanted to have both RAW and COOKED keys?  You can do
  1870. it by checking the keys for whatever raw keys you want, and then using
  1871. the  console.device's RawKeyConvert routine, except that it's a hassle
  1872. to start mucking about with the device.
  1873.  
  1874.     Well, here you go!  A nice, clean way of converting from a raw key
  1875. to  a  cooked  key,  in a single call!  All you have to do is pass the
  1876. code  and  qualifier  from  your  intuimessage, and the address of the
  1877. message  itself, and you will get back the ASCII value of the key that
  1878. was  hit.  This does, in fact, use the console.device's RawKeyConvert,
  1879. so that if you have a different keymap set, it will be used.
  1880.  
  1881. EXAMPLE
  1882.  
  1883.  
  1884. struct IntuiMessage *im;
  1885.  
  1886.     key = RawKeyToAscii(im->Code,im->Qualifier,im->IAddress);
  1887.  
  1888. -------------------------------------------------------------------
  1889.  
  1890. NAME
  1891.          NewGetString
  1892.  
  1893. SYNOPSIS
  1894.  
  1895. BOOL = NewGetString(&GetStringStruct)
  1896. D0                         A0
  1897.  
  1898. DESCRIPTION
  1899.  
  1900.     This is very similar to GetLong() above, except that it allows you
  1901. to  get  an  ASCII  string.   As opposed to GetLong, however, you have
  1902. control  over  how  wide  the  window  is, and how many characters the
  1903. string gadget can contain.  All unused fields MUST be set to 0.
  1904.  
  1905. RETURNS
  1906.  
  1907.     It  returns  TRUE  if  the  user  clicked  OK or hit return, or it
  1908. returns FALSE if the user clicked the close box or CANCEL.
  1909.